package com.zte.shopping.mapper.staff;

import com.zte.shopping.entity.Staff;
import com.zte.shopping.entity.User;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 *
 * @author zuti666
 */
@Repository
public interface StaffMapper {

    /**
     * 根据loginName查询是否存在用户
     * @param loginName
     * @return
     */
    public  int findStaffByLoginName(@Param("loginName") String loginName);

    /*
     * @Author zuti
     * @Description //TODO 根据用户名和密码登录
     * @Date 7:39 2020/6/24
     * @Param
     * @return
     **/
    public Staff staffLogin(@Param("loginName") String loginName, @Param("password") String password);

    /**
     * @Author zuti
     * @Description //TODO 查询管理员列表
     * @Date 16:50 2020/6/28
     * @Param [from, pageSize]
     * @return java.util.List<com.zte.shopping.entity.Staff>
     **/
     public  List<Staff> staffList(@Param("from") int from, @Param("pageSize") int pageSize);

     public int staffListCount();

     /**
      * @Author zuti
      * @Description //TODO 按条件查询员工列表
      * @Date 21:45 2020/6/28
      * @Param [from, pageSize, userName, loginName, phone, email, deptId, isValid]
      * @return java.util.List<com.zte.shopping.entity.User>
      **/
     List<Staff> searchStaffByParmaList(@Param("from") int from,
                                     @Param("pageSize") int pageSize,
                                     @Param("userName") String userName,
                                     @Param("loginName") String loginName,
                                     @Param("phone") String phone,
                                     @Param("email") String email,
                                     @Param("deptId")Integer deptId,
                                     @Param("isValid") Integer isValid);

    int staffListCountByParamList(@Param("userName") String userName,
                                  @Param("loginName") String loginName,
                                  @Param("phone") String phone,
                                  @Param("email") String email,
                                  @Param("deptId")Integer deptId,
                                  @Param("isValid") Integer isValid);

    void updateStaffStatus(@Param("staffId") int parseInt,
                           @Param("status") Integer staffStatus);

    Staff selectByLoginName(@RequestParam("loginName") String loginName);

    void insertStaff(Staff staff);

    void updateStaff(Staff staff);

    Staff selectById666(@Param("staffId") Integer staffId);
}